package com.szholly.plug.form.excel.web.interceptor;

import java.util.ArrayList;
import java.util.List;

/**
 * 注册Excel拦截器
 */
public class ExcelInterceptorRegister {
	/**
	 * 编辑拦截
	 */
	public static List<IExcelInterceptor> excelInterceptor = new ArrayList<IExcelInterceptor>();

	/**
	 * 注册编辑拦截接口
	 * @param editInterceptor
	 */
	public static void RegDbInterceptor(IExcelInterceptor editInterceptor) {
		if (editInterceptor == null)
			return;

		if (editInterceptor instanceof IExcelInterceptor) {
			if (!excelInterceptor.contains((IExcelInterceptor) editInterceptor)) {
				excelInterceptor.add((IExcelInterceptor) editInterceptor);
			}
		}
	}

	/**
	 * 移除编辑拦截接口
	 * @param editInterceptor
	 */
	public static void RemoveDbInterceptor(IExcelInterceptor editInterceptor) {
		if (editInterceptor == null)
			return;

		if (editInterceptor instanceof IExcelInterceptor) {
			if (excelInterceptor.contains((IExcelInterceptor) editInterceptor)) {
				excelInterceptor.remove((IExcelInterceptor) editInterceptor);
			}
		}
	}
}
